import { defineStore } from 'pinia'
import { userinfo,note } from '../type'
export const user = defineStore('user',{
    state:()=>{
        return {
            user:{} as userinfo
        }
    },
})


export const notes = defineStore('notes',{
    state:()=>{
        return {
            noteids:[] as string[],
            notes:[] as note[],
            note:{} as note,
            isnull:true,
            show:true
        }
    },
    getters:{
        notecolor:function(state):any{
            return state.note.color
        },
        gettersShow:function(state):any{
            return state.show
        }
    },
    persist:{
        enabled: true,
        strategies: [
            {
                key: 'notes',//设置存储的key
                storage: localStorage,//表示存储在localStorage
                paths:['notes'],
            }
        ]
    }
}) 

interface clip {
    title:string,
    content:string
}

export const clipboard = defineStore('clipboard',{
    state:()=>{
        return {
            clipboard:[] as clip[]
        }
    },
    persist:{
        enabled: true,
        strategies: [
            {
                key: 'clipboard',//设置存储的key
                storage: localStorage,//表示存储在localStorage
                paths:['clipboard'],
            }
        ]
    }
})